#include <func.h>

int main(int argc,char *argv[])
{
    pid_t pid=fork();
    int status;
    if(0==pid)
    {
        printf("I am child!\n");
        //int i=1;
        //i/=0;
        //printf("i=%d\n",i);
        char* p=NULL;
        *p=6;
        return 0;
    }
    else
    {
        printf("I am parent!\n");
        pid_t pid=wait(&status);
        if(WIFEXITED(status))
        {
            printf("child exit normally! pid is %d\n",pid);
            printf("退出码为%d\n",WEXITSTATUS(status));
        }
        else
        {
            printf("Child crash\n");

        }
        while(1);
    }
    return 0;
}

